/****

    activequant - activestocks.eu

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

	
	contact  : contact@activestocks.eu
    homepage : http://www.activestocks.eu

****/
package org.activequant.core.domainmodel.events;

import java.io.Serializable;

import org.activequant.core.domainmodel.account.Order;
import org.activequant.core.domainmodel.account.OrderHistory;
import org.activequant.core.types.TimeStamp;

/**
 * Event that confirms order update.
 * It holds the original (before-update) image of the order.
 * The most current updated order can be found in {@link OrderHistory#getOrder()}.<br/>
 * An OrderEvent subclass. Holds the following associated variable:
 * <ul>
 * <li>updated(Order)</li>
 * </ul>
 * And these inherited variables:
 * <ul>
 * <li>id(Long)</li>
 * <li>eventTimeStamp(TimeStamp)</li>
 * <li>message(String)</li>
 * </ul>
 * <br>
 * <b>History:</b><br>
 *  - [11.12.2007] Created (Mike Kroutikov)<br>
 *
 *  @author Mike Kroutikov
 */
public class OrderUpdateEvent extends OrderEvent implements Serializable {

	private static final long serialVersionUID = 1011615893930688369L;
	/**
	 * private Order updated;
	 */
	private Order updated;

	/**
	 * Creates empty event.<br/>
	 * an empty OrderUpdateEvent(OrderEvent subclass) constructor
	 */
	public OrderUpdateEvent() { }
	/**
	 * constructs an OrderUpdateEvent(OrderEvent subclass) using the given stamp(TimeStamp), message(String) and updated(Order)
	 * to set its associated/inherited eventTimeStamp(TimeStamp), message(String) and updated(Order)
	 * @param stamp
	 * @param message
	 * @param updated
	 */
	public OrderUpdateEvent(TimeStamp stamp, String message, Order updated) {
		super(stamp, message);
		this.updated = updated;
	}
	
	/**
	 * Image of the order after the update has been applied.<br/>
	 * returns the associated updated(Order)
	 * @return order image.
	 */
	public Order getUpdatedOrder() {
		return updated;
	}
	
	/**
	 * Sets the updated order.<br/>
	 * sets the associated updated(Order) with the given val(Order)
	 * @param val order image.
	 */
	public void setUpdatedOrder(Order val) {
		updated = val;
	}
	/**
	 * returns a String in the form: "OrderUpdateEvent: eventTimeStamp=${eventTimeStamp}, updatedOrder=${updated}"
	 */
	public String toString() {
		return "OrderUpdateEvent: eventTimeStamp=" + getEventTimeStamp() + ", updatedOrder=" + updated;
	}
}